Skip to content

gh-145378: Generate consistent colors for pdb commands#149305

Open
gaogaotiantian wants to merge 4 commits intopython:mainfrom
gaogaotiantian:gen-colors-for-pdb-commands
Open

gh-145378: Generate consistent colors for pdb commands#149305
gaogaotiantian wants to merge 4 commits intopython:mainfrom
gaogaotiantian:gen-colors-for-pdb-commands

Conversation

@gaogaotiantian
Copy link
Copy Markdown
Member

@gaogaotiantian gaogaotiantian commented May 3, 2026

We supported pyrepl for pdb input. We used the default pyrepl color scheme which works most of the time. However, for pdb commands, they are not recognized. There are also some pdb commands (list, continue) that would be recognized as different things in pyrepl.

We should recognize those commands and use a consistent color for it. It's actually pretty helpful because users will (probably) realize that a = 1 won't work because a has a special color (a is a command for arg).

@corona10 corona10 self-assigned this May 3, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 3, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32512833 | 📁 Comparing 9b5aa70 against main (c1940bc)

  🔍 Preview build  

5 files changed · ± 5 modified

± Modified

Comment thread Lib/pdb.py
return None

def gen_colors(self, buffer):
from _pyrepl.utils import ColorSpan, Span
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nit comment, now we can use lazy import right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the import has to be conditional per #145035. Similarly to what Hugo had to do here.

Copy link
Copy Markdown
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants